﻿@model CmsAdminSearchSnippetModel

@{
    ResFile = "cms_Common";
}

@functions{

    IEnumerable<SelectListItem> GetSource(IEnumerable<string> values)
    {
        foreach (var t in values)
        {
            yield return new SelectListItem() {Text = _(t), Value = t};
        }
    }
}

<div class="b-form b-form-search b-form-search_global">
@using (Html.BeginForm("Search", "CmsSearch", FormMethod.Post))
{
    <fieldset>
        <span class="text">
            @Html.TextBoxFor(p => p.SearchQuery,
            new
            {
                @class = "text",
                onfocus = string.Format(@"if(this.value=='{0}') this.value='';", _("Enter Keyword(s)")),
                onblur = string.Format(@"if(this.value=='') this.value='{0}';", _("Enter Keyword(s)"))
            })
            @Html.ListBoxFor(x => x.SearchAreas, GetSource(Model.AllSearchAreas), new { multiple = "multiple", @class = "hide" })
        </span>
        <input id="searchButton" type="submit" value="@_("Go")" class="b-button b-button_small" />
    </fieldset>
    <script type="text/javascript">
        var el = document.getElementById('SearchQuery');
        if(el.value === ''){
            el.value = '@_("Enter Keyword(s)")';
         }
    </script>
}
</div>

